package com.ymttest.database.sqlwapper.hunter;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ymt.database.SqlManager;
import com.ymttest.database.model.hunter.HunterSaleAmountDetail;

public class HunterSaleAmountDetailWrapper {
	
	SqlManager manager;

    public HunterSaleAmountDetailWrapper() {
        manager = new SqlManager("tradingsettlement");
    }
    
    @SuppressWarnings("unchecked")
	public List<HunterSaleAmountDetail> selectByOrderId(Long orderId) {
    	
    	List<HunterSaleAmountDetail> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.hunter.HunterSaleAmountDetailMapper.selectByOrderId",
                        orderId);
        manager.commit();
        
        return result;
    }
    
    @SuppressWarnings("unchecked")
	public HunterSaleAmountDetail selectByOrderIdAndHunterId(Long orderId, Long hunterId) {
    	
    	HunterSaleAmountDetail hunterSaleAmountDetail = new HunterSaleAmountDetail();
    	Map<String, Long> map = new HashMap<String, Long>();
    	
    	map.put("orderId", orderId);
    	map.put("hunterId", hunterId);
    	
    	List<HunterSaleAmountDetail> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.hunter.HunterSaleAmountDetailMapper.selectByOrderIdAndHunterId",
                        map);
        manager.commit();
        
        if (result.size() > 0)
        	hunterSaleAmountDetail = result.get(0);
        
        return hunterSaleAmountDetail;
    }
    
    public static void main(String[] args) {
    	HunterSaleAmountDetailWrapper test = new HunterSaleAmountDetailWrapper();
    	
    	System.out.println(test.selectByOrderIdAndHunterId(2087818699L, 1022L).getSale_amount());
    }
}
